﻿using System.Configuration;
using Logic.SocialNetworks;

namespace Social
{
	public class SocialNetworkFactory
	{
		#region Readonly Variables
		static readonly string FbapiKey = ConfigurationManager.AppSettings["fbApiKey"];
		static readonly string flickrapiKey = ConfigurationManager.AppSettings["flickrApiKey"];
		static readonly string flickrsecret = ConfigurationManager.AppSettings["flickrSecret"];
		static readonly string ytAppName = ConfigurationManager.AppSettings["ytAppName"];
		static readonly string ytApiKey = ConfigurationManager.AppSettings["ytApiKey"];

		#endregion

		#region Properties
		//public FacebookInterface Face  { get;	private set; }
		//public FacebookGraphAPI NewFace { get; private set; }
		//public YouTubeService Yts { get; private set; }
		//public flickrWrapper Flickr { get; private set; }
		//#endregion
 
		//#region Constructor
		//public SocialNetworksAuthenticator(BO.User user)
		//{
		//    this.Face = GetFacebookInterface(user);
		//    this.Yts = GetYouTubeService(user);
		//    this.Flickr = GetFlickrWrapper(user);
		//    this.NewFace = GetNewFace(user);
		//}

		//public SocialNetwork GetApi();



		//#endregion

		//#region Methods

		//public FacebookGraphAPI GetNewFace(BO.User user)
		//{
		//    if (user.FBAccessToken.IsExists())
		//        return new FacebookGraphAPI(user.FBAccessToken);
		//    else
		//        return null;
		//}


		//public static flickrWrapper GetFlickrWrapper(BO.User user)
		//{
		//    if (user.FlickrToken.IsExists())
		//        return new flickrWrapper(flickrapiKey, flickrsecret, BLL.Encryption.Decrypt(user.FlickrToken));
		//    else
		//        return null;
		//}

		//public static FacebookInterface GetFacebookInterface(BO.User user)
		//{
		//    if (Extensions.IsAllExists(user.FBSecret, user.FBSessionKey))
		//        return new FacebookInterface(FbapiKey, user.FBSessionKey, BLL.Encryption.Decrypt(user.FBSecret));
		//    else
		//        return null;
		//}

		//public static YouTubeService GetYouTubeService(BO.User user)
		//{
		//    if (Extensions.IsAllExists(user.YTPassword, user.YTUsername))
		//        return new YouTubeService(ytAppName,ytApiKey);
		//    else
		//        return null;
		//}

		public static YouTubeService GetYouTubeService()
		{
			return new YouTubeService(ytAppName,ytApiKey);
		}
		 
		#endregion
	}
}